/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package EDT.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author ali
 */
public class ModifFicheVoeuForm extends org.apache.struts.action.ActionForm {
    
     private String key;

    private String requette;

    
    
    private int interv;
    private int annee;
    
    private String periode;
    
    private int moment1;
    private int poids1;
    private int priorite1;

    private int moment2;
    private int poids2;
    private int priorite2;
    
    private int moment3;
    private int poids3;
    private int priorite3;
    
    private int moment4;
    private int poids4;
    private int priorite4;
    
    private int moment5;
    private int poids5;
    private int priorite5;
    
    private String valide;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getRequette() {
        return requette;
    }

    public void setRequette(String requette) {
        this.requette = requette;
    }

    public int getInterv() {
        return interv;
    }

    public void setInterv(int interv) {
        this.interv = interv;
    }

    public int getAnnee() {
        return annee;
    }

    public void setAnnee(int annee) {
        this.annee = annee;
    }

    public String getPeriode() {
        return periode;
    }

    public void setPeriode(String periode) {
        this.periode = periode;
    }

    public int getMoment1() {
        return moment1;
    }

    public void setMoment1(int moment1) {
        this.moment1 = moment1;
    }

    public int getPoids1() {
        return poids1;
    }

    public void setPoids1(int poids1) {
        this.poids1 = poids1;
    }

    public int getPriorite1() {
        return priorite1;
    }

    public void setPriorite1(int priorite1) {
        this.priorite1 = priorite1;
    }

    public int getMoment2() {
        return moment2;
    }

    public void setMoment2(int moment2) {
        this.moment2 = moment2;
    }

    public int getPoids2() {
        return poids2;
    }

    public void setPoids2(int poids2) {
        this.poids2 = poids2;
    }

    public int getPriorite2() {
        return priorite2;
    }

    public void setPriorite2(int priorite2) {
        this.priorite2 = priorite2;
    }

    public int getMoment3() {
        return moment3;
    }

    public void setMoment3(int moment3) {
        this.moment3 = moment3;
    }

    public int getPoids3() {
        return poids3;
    }

    public void setPoids3(int poids3) {
        this.poids3 = poids3;
    }

    public int getPriorite3() {
        return priorite3;
    }

    public void setPriorite3(int priorite3) {
        this.priorite3 = priorite3;
    }

    public int getMoment4() {
        return moment4;
    }

    public void setMoment4(int moment4) {
        this.moment4 = moment4;
    }

    public int getPoids4() {
        return poids4;
    }

    public void setPoids4(int poids4) {
        this.poids4 = poids4;
    }

    public int getPriorite4() {
        return priorite4;
    }

    public void setPriorite4(int priorite4) {
        this.priorite4 = priorite4;
    }

    public int getMoment5() {
        return moment5;
    }

    public void setMoment5(int moment5) {
        this.moment5 = moment5;
    }

    public int getPoids5() {
        return poids5;
    }

    public void setPoids5(int poids5) {
        this.poids5 = poids5;
    }

    public int getPriorite5() {
        return priorite5;
    }

    public void setPriorite5(int priorite5) {
        this.priorite5 = priorite5;
    }

    public String getValide() {
        return valide;
    }

    public void setValide(String valide) {
        this.valide = valide;
    }

    @Override
    public String toString() {
        return "ModifierFicheVoeuxForm{" + "key=" + key + ", requette=" + requette + ", interv=" + interv + ", annee=" + annee + ", periode=" + periode + ", moment1=" + moment1 + ", poids1=" + poids1 + ", priorite1=" + priorite1 + ", moment2=" + moment2 + ", poids2=" + poids2 + ", priorite2=" + priorite2 + ", moment3=" + moment3 + ", poids3=" + poids3 + ", priorite3=" + priorite3 + ", moment4=" + moment4 + ", poids4=" + poids4 + ", priorite4=" + priorite4 + ", moment5=" + moment5 + ", poids5=" + poids5 + ", priorite5=" + priorite5 + ", valide=" + valide + '}';
    }
    
    
    /**
     *
     */
 
    public ModifFicheVoeuForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    
    
    
    /**
     * This is the action called from the Struts framework.
     *
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        
      if ((getMoment1() == 1 || getMoment1()==2) && getPoids1()==0) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
      if ((getMoment2() == 1 || getMoment2()==2) && getPoids2()==0) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
      if ((getMoment3() == 1 || getMoment3()==2) && getPoids3()==0) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
      if ((getMoment4() == 1 || getMoment4()==2) && getPoids4()==0) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
      if ((getMoment5() == 1 || getMoment5()==2) && getPoids5()==0) {
            errors.add("name", new ActionMessage("error.name.required"));
            // TODO: add 'error.name.required' key to your resources
        }
      
        return errors;
    }
    /**
     *
     */
   
}
